<template>
  <div class="device">
    <iframe 
      v-if="iframeUrl"
      frameborder="0"
      class="wrap"
      :src="iframeUrl" />
  </div>
</template>

<script>
import { tokenStorageKey } from 'common/js/config'
import { getStorage } from 'common/js/utils'

export default {
  name: 'device',
  created () {
    this.iframeUrl = 'https://219.128.72.158:28900/iot-main/iframePage/facilityManageIframe?access_token=' + getStorage(tokenStorageKey).token
    // this.iframeUrl = 'https://219.128.72.158:28900/iot-main/iframePage/facilityManageIframe?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcHVzTG9naW5Vc2VyIjp7InVzZXIiOnsidXNlcklkIjoiYTJlMzA0NDctNzc5ZC00OTRmLWE3NjQtNjQ4OTRiNmI1MjhlIiwidXNlck5hbWUiOiLotoXnuqfnrqHnkIblkZgiLCJsb2dpbk5hbWUiOiJhZ2NvbWFkbWluIiwibG9naW5Qd2QiOm51bGwsImlzTG9jayI6IjAiLCJsb2dpbkZhaWxOdW0iOjAsImxvY2tUaW1lIjpudWxsLCJpc0FjdGl2ZSI6IjEiLCJhY3RpdmVCZWdpblRpbWUiOm51bGwsImFjdGl2ZUVuZFRpbWUiOm51bGx9LCJvcmdzIjpbeyJvcmdJZCI6IjQyMzQ2Iiwib3JnTmFtZSI6IuW6lOeUqOezu-e7n-e7hOe7hyJ9LHsib3JnSWQiOiI4M2YxYjJjMi1kNzJlLTQxMjQtYjNhYS1kZmY0MmY3YWM2MzYiLCJvcmdOYW1lIjoi5o6S5rC05bqU55SoIn0seyJvcmdJZCI6IjQ4MzQ3ZjBiLWZmOGYtNGI4ZS1hYWZmLTk0NjEwMWUzNGMzYiIsIm9yZ05hbWUiOiLmjpLmsLTnrqHkupXnrqHnkIYifSx7Im9yZ0lkIjoiMWJlOGNlMDUtMzExZi00NmEwLTliODAtOGEyNDE4NjBkYmNmIiwib3JnTmFtZSI6IuS9m-WxseW4guawtOWKoeWxgCJ9XSwiY3VycmVudE9yZ0lkIjoiMDM2ODk0OGEtMWNkZi00YmY4LWE4MjgtNzFkNzk2YmE4OWY2IiwiY3VycmVudE9yZ0NvZGUiOiJSMDI5IiwiY3VycmVudFRtbiI6Im9cdTAwMEZia1xmZSIsImFwcFNvZnRDb250ZXh0cyI6W10sInRtbk1lbnVDb250ZXh0cyI6W119LCJpbmRleENvbmZpZ1VybCI6bnVsbCwidXNlcl9uYW1lIjoiYWdjb21hZG1pbiIsInNjb3BlIjpbImFsbCJdLCJleHAiOjE5MTg2OTU0MDIsImp0aSI6Ijk2YTEwMGYzLTljY2EtNDBmYy04MTAzLTM5NWU3ZjYxY2I4NiIsImNsaWVudF9pZCI6Imd6cHMteXRoIiwicHdkRXhwaXJlZFRpbWUiOiIyMDI2LTAxLTI0In0.9IL5vg7tUj2cyi4kkKalRPok-leMLWpBXU8SIbZwR-Q'
  },
  beforeDestroy () {
    this.iframeUrl = ''
  },
  data () {
    return {
      iframeUrl: ''
    }
  }
}
</script>

<style lang="scss" scoped>
.device {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  .wrap {
    width: 100%;
    height: 100%;
    position: relative;
  }
}
</style>
